package com.platform.apex.util;

import com.fasterxml.jackson.annotation.JsonProperty;

public class MetadataStorageConnectorConfig {

	@JsonProperty
	private boolean createTables = true;

	
	
	@JsonProperty
	private String host = "localhost";

	@JsonProperty
	private int port = 1527;

	@JsonProperty
	private String connectURI;

	@JsonProperty
	private String user = null;

	@JsonProperty("password")
	private String password;

	public boolean isCreateTables() {
		return createTables;
	}

	public String getHost() {
		return host;
	}

	public int getPort() {
		return port;
	}

	public String getConnectURI() {
		if (connectURI == null) {
			return String.format("jdbc:derby://%s:%s/metadata-db;create=true", host,
					port);
		}
		return connectURI;
	}

	public String getUser() {
		return user;
	}

	public String getPassword() {
		return password;
	}

	@Override
	public String toString() {
		return "DbConnectorConfig{" + "createTables=" + createTables
				+ ", connectURI='" + getConnectURI() + '\'' + ", user='" + user
				+ '\'' + ", password=" + password + '}';
	}
}
